package cn.iocoder.yudao.module.liveprice.controller.admin;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.liveprice.service.price.PriceCacheService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * 价格查询接口
 */
@Tag(name = "管理后台 - 实时价格")
@RestController
@RequestMapping("/price")
@RequiredArgsConstructor
public class PriceController {

    private final PriceCacheService priceCacheService;

    @GetMapping("/get")
    @Operation(summary = "获取价格")
    @Parameter(name = "id", description = "价格ID", required = true, example = "AAPL")
    public CommonResult<Object> getPrice(@RequestParam("id") String id) {
        Object price = priceCacheService.getPrice(id);
        return success(price);
    }
} 